/*
 * 检验检查表格数据展示
 * */

// 检验简约报告分组规则加载
function jianYanList(){
	 jingDianJqGride();// 经典模式-左边列表
	 jianyueJqGride(); // 简约模式
}
function addJyFenzuguize() {
	/*---------------------------简约模式----------------------------*/
	
	var options = [ {"text" : "检验时间","id" : "FLAB20"}, {"text" : "仪器","id" : "BEY03"}, {"text" : "项目名称","id" : "BBX05"},
	                {"text" : "缩写","id" : "BFC03"}, {"text" : "结果","id" : "LAC08"}, {"text" : "单位","id" : "BDG02"},
	                {"text" : "状态","id" : "LAC11"}, {"text" : "参考范围","id" : "LAC15"}, {"text" : "打印","id" : "FPRINT"},
	                {"text" : "样本类型","id" : "ABB02"}, {"text" : "婴儿姓名","id" : "VAP05"}];
	            $('#jianyan_fenzu1').select2({language: "zh-CN",data:options,placeholder:'请选择分组规则',allowClear: true});
	            $('#jianyan_fenzu2').select2({language: "zh-CN",data:options,placeholder:'请选择分组规则',allowClear: true});
	            $('#jianyan_fenzu3').select2({language: "zh-CN",data:options,placeholder:'请选择分组规则',allowClear: true});

	            $('#jianyan_fenzu1').val('FLAB20').trigger('change');
	            $('#jianyan_fenzu2').val('BEY03').trigger('change');
	            $('#jianyan_fenzu3').val('').trigger('change');

	            $('#jianyan_fenzu1').bind('change',function(){
	            	jianyueJqGride();
	            });
	            $('#jianyan_fenzu2').bind('change',function(){
	            	jianyueJqGride();
	            });
	            $('#jianyan_fenzu3').bind('change',function(){
	            	jianyueJqGride();
	            });
	/*---------------------------经典模式----------------------------*/
	 var options = [ {"text" : "仪器","id" : "BEY03A"}, {"text" : "病区","id" : "BCK01D"}, {"text" : "工作单位","id" : "BAQ03"},
	                 {"text" : "病历号","id" : "VAA01"}, {"text" : "病人科室","id" : "BCK01A"}, {"text" : "病人类别","id" : "BDP02"},
	                 {"text" : "床号","id" : "LAB16"}, {"text" : "生理特征","id" : "BES02"}, {"text" : "标本形态","id" : "LAB42"},
	                 {"text" : "诊断","id" : "LAB18"}, {"text" : "执行科室","id" : "BCK03C"}, {"text" : "样本条码","id" : ""	},
	                 {"text" : "申请科室","id" : "BCK03B"} , {"text" : "审核时间","id" : "LAB53"}, {"text" : "检验人","id" : "BCE03D"},
	                 {"text" : "核收人","id" : "BCE03C"}, {"text" : "采样人","id" : "BCE03A"}];
	             $('#jd_fenzu1').select2({language: "zh-CN",data:options,placeholder:'请选择分组规则',allowClear: true});
	             $('#jd_fenzu2').select2({language: "zh-CN",data:options,placeholder:'请选择分组规则',allowClear: true});
	             $('#jd_fenzu3').select2({language: "zh-CN",data:options,placeholder:'请选择分组规则',allowClear: true});

	             $('#jd_fenzu1').val('BEY03A').trigger('change');
	             $('#jd_fenzu2').val('').trigger('change');
	             $('#jd_fenzu3').val('').trigger('change');

	             $('#jd_fenzu1').bind('change',function(){
	            	 jingDianJqGride();
	             });
	             $('#jd_fenzu2').bind('change',function(){
	            	 jingDianJqGride();
	             });
	             $('#jd_fenzu3').bind('change',function(){
	            	 jingDianJqGride();
	             });
}
//检查报告select 分组加载
function addJianchaFenzu(){
	var options = [ {"text" : "姓名","id" : "PAA07"}, {"text" : "检查仪器","id" : "BHF03"}, {"text" : "影像提示","id" : "PAB11"},
	                {"text" : "影像号","id" : "PAA06"}, {"text" : "阳性提示","id" : "PAA46"}, {"text" : "业务范围","id" : "ACF02"},
	                {"text" : "审核时间","id" : "PAB13"}];
	            $('#jiancha_fenzu1').select2({language: "zh-CN",data:options,placeholder:'请选择分组规则',allowClear: true});
	            $('#jiancha_fenzu2').select2({language: "zh-CN",data:options,placeholder:'请选择分组规则',allowClear: true});
	            $('#jiancha_fenzu3').select2({language: "zh-CN",data:options,placeholder:'请选择分组规则',allowClear: true});

	            $('#jiancha_fenzu1').val('').trigger('change');
	            $('#jiancha_fenzu2').val('').trigger('change');
	            $('#jiancha_fenzu3').val('').trigger('change');

	            $('#jiancha_fenzu1').bind('change',function(){
	            	jianChaJqGride();
	            });
	            $('#jiancha_fenzu2').bind('change',function(){
	            	jianChaJqGride();
	            });
	            $('#jiancha_fenzu3').bind('change',function(){
	            	jianChaJqGride();
	            });
}
//检查jqgride数据组装
  var currentPage = 1;
  var rownumber = 1000;
function jianChaJqGride(){
	debugger;
	var vaa03 = $("#patient_vaa03").text().trim();
	 var group1="";
	 var tabe_id="check-report-table";
	 var groupName = [];
     var groupText = [];
     var groupShow = [];
//     var groupAjax={};
     var isGroup = false;
     var g1 = $('#jiancha_fenzu1').val();
     var g2 = $('#jiancha_fenzu2').val();
     var g3 = $('#jiancha_fenzu3').val();
     if(g1){groupName.push(g1);}
     if(g2){groupName.push(g2);}
     if(g3){groupName.push(g3);}
     if(groupName.length>0){
    	 group1+= " order by ";
         isGroup = true;
         for(var i=0;i<groupName.length;i++){
             groupShow.push(true);
             groupText.push('<label class="label-normal label-spring">{0} - {1}</label>');
             if(i == groupName.length -1){
            	 group1 +=groupName[i];
             }else{
            	 group1 +=groupName[i]+",";
             }
         }
     }
  
 	var url = mqUrl+"/Mq/MQRisPacs/selectRicPacs";
 	var params = {};
 	params.ACF01 = 3;
 	params.GROUP = group1;
 	params.PAA11 = vaa03;//门诊号
 	params.PAA11 = vaa03;//门诊号
 	params.jsessionids=jsessionids;
     jQuery('#check-report-table').GridUnload();
     jQuery("#check-report-table").jqGrid({
         url: url,
         postData: params,
         datatype: "jsonp",
         mtype: 'get',
         height: 'auto',
         width: "auto",
         colModel: [
             {label: '姓名',name: 'PAA07',align: "center",sortable:false},
             {label: '检查仪器',name: 'BHF03',align: "center",sortable:false},
             {label: '影像号',name: 'PAA06',align: "center",sortable:false},
             {label: '检查项目',name: 'PAA43',align: "center",sortable:false},
             {label: '业务范围',name: 'BFC03',align: "center",sortable:false},
             {label: '影像提示',name: 'PAB11',align: "center",sortable:false},
             {label: '阳性提示',name: 'PAA46',align: "center",sortable:false},
             {label: '图片完整路径',name: 'vtAllPath',align: "center",hidden:true},
             {label: '图片路径',name: 'vtPath',align: "center",hidden:true},
             {label: 'PAA01',name: 'PAA01',hidden:true}
         ],
         rowNum: rownumber,
         sortname: 'lab20',
         grouping: isGroup, //是否分组，默认为false
         groupingView: {
             groupField: groupName, //分组字段
             groupColumnShow: groupShow,    //是否显示分组列
             groupText: groupText,   // 表头显示的数据以及相应的数据量
             groupCollapse: false, // 加载数据时是否只显示分组的组信息
             groupDataSorted:false   // 分组中的数据是否排序
             //plusicon:"ui-icon-circle-plus",
             //minusicon:"ui-icon-circle-minus"
             //groupOrder: ['desc']  // 分组后的排序
         },
         onSelectRow: function (id) {
        	 debugger;
        	 var indexl = layer.msg('加载中....', {icon: 16,shade: [0.1, '#393D49'],time:0,skin: 'layui-layer-msg16'}); 
        	 $('#papImg_pacs').attr('src','');
             var row = $("#check-report-table").jqGrid("getRowData", id);
             if(row.vtAllPath){
            	 if(row.vtAllPath.indexOf("http")>-1){
            		 showImagePacture(row.vtAllPath);
            	 }else{
            		 $('#img_picture').addClass("hidden");
            		 $('#papImg_pacs').removeClass("hidden");
            		 $('#papImg').attr('src',mqUrl+"/Mq/MQRisPacs/downloadFile?jpgURL="+row.vtAllPath).on('load', function(){
            			 layer.close(indexl);
            	     }).error(function(){
            	    	 layer.close(indexl);
            	     });
            	 }
             }else{
            	 $('#papImg_pacs').attr('src',hosturl+"/theme/img/nodata.png");
            	 $('#img_picture').empty().html("暂无对应图片");
            	 layer.close(indexl);
             }
         },
         loadComplete: function (data) {
//             loadPage(currentPage);
        	//无数据的时候展示暂无数据信息
 			if (data.length < 1) {
 				var $tr = $('#'+tabe_id).find('tbody>tr:last');
 				var len = $tr.find('td').length;
 				$("#"+tabe_id).html('<tr class="no-data"><td colspan="'+ parseInt(len)+ '" style="text-align:left;">没有符合条件的数据！</td></tr>');
 			}
 			if(valueArr['p_100_105002_425']=="1"){
 				getDataToTable();//调取眼科信息
 			}

         },
         loadError:function(xhr,status,error){
        	 /*layer.msg('检查单服务连接失败！', {
 				time : 2000,
 				icon : 0,
 				skin : 'layui-layer-msg0'
 			});*/
         }

     });
	
}

function showImagePacture(vtAllPath){
	 var arr = vtAllPath.split("||");
	 if(arr.length>0){
		 $('#img_picture').removeClass("hidden");
		 $('#papImg_pacs').addClass("hidden");
		 var html = "";
		 for(var i=0;i<arr.length;i++){
			 html+='<img src='+arr[i]+' style="height:100%; width:100%" />'
		 }
		 $('#img_picture').empty().append(html);
	 }else{
		 $('#img_picture').empty().html("暂无对应图片");
	 }
}
/*检验经典数据加载*/

function jingDianJqGride(){
	debugger;
	var vaa03 = $("#patient_vaa03").text().trim();
	var tabe_id = "jingdian_left_table";
	 var groupName = [];
     var groupText = [];
     var groupShow = [];
     var group1="";
     var isGroup = false;
     var g1 = $('#jd_fenzu1').val();
     var g2 = $('#jd_fenzu2').val();
     var g3 = $('#jd_fenzu3').val();
     if(!!g1){groupName.push(g1);}
     if(!!g2){groupName.push(g2);}
     if(!!g3){groupName.push(g3);}
     if(groupName.length>0){
         isGroup = true;
         group1+= " order by ";
         for(var i=0;i<groupName.length;i++){
             groupShow.push(true);
             groupText.push('<label class="label-normal label-spring">{0} - {1}</label>');
             if(i == groupName.length -1){
            	 group1 +=groupName[i];
             }else{
            	 group1 +=groupName[i]+",";
             }
         }
     }
     jQuery('#jingdian_left_table').GridUnload();
     var params = {};
 	params.ACF01 = 1;
 	params.LAB09 = vaa03;// 门诊号
	params.GROUP = group1;
 	params.VAA03 = '';
 	params.type = 1;
 	params.currPage = currentPage;
 	params.pageSize = rownumber;
 	params.jsessionids=jsessionids;
     jQuery("#jingdian_left_table").jqGrid({
         url: mqUrl+"/Mq/MQRisPacs/queryJianYan",
         postData: params,
         datatype: "jsonp",
         mtype: 'get',
         height: 'auto',
         width: "auto",
         colModel: [
             {label: '仪器',name: 'BEY03A',align: "center",sortable:false},
             {label: '检验时间',name: 'LAB20',align: "center",formatter:'date',formatoptions:{srcformat: 'Y-m-d H:i:s', newformat: 'Y-m-d H:i:s'},sortable:false},
             {label: '样本号',name: 'LAB22',align: "center",sortable:false,width:"100"},
             {label: '病历号',name: 'LAB09',align: "center",sortable:false},
             {label: '姓名',name: 'VAA05',align: "center",sortable:false},
             {label: '性别',name: 'ABW02',align: "center",sortable:false},
             {label: '年龄',name: 'LAB12',align: "center",sortable:false},
             {label: '审核人',name: 'BCE03B',align: "center",sortable:false},
             {label: '打印',name: 'LAB36',align: "center",sortable:false},
             {label: '样本序号',name: 'LAB23',align: "center",sortable:false},
             {label: '病人科室',name: 'BCK03A',align: "center",sortable:false},
             {label: '病人类别',name: 'BDP02',align: "center",sortable:false},
             {label: '床号',name: 'LAB16',align: "center",sortable:false},
             {label: '生理特征',name: 'BES02',align: "center",sortable:false},
             {label: '诊断',name: 'LAB18',align: "center",sortable:false},
             {label: '标本形态',name: 'BEW02',align: "center",sortable:false},
             {label: '执行科室',name: 'BCK03B',align: "center",sortable:false},
             {label: '样本条码',name: 'LAB42',align: "center",sortable:false},
             {label: '婴儿姓名',name: 'VAP05',align: "center",sortable:false},
             {label: '婴儿性别',name: 'ABW02P',align: "center",sortable:false},
             {label: '婴儿出生日期',name: 'VAP07',align: "center",formatter:'date',formatoptions:{srcformat: 'Y-m-d H:i:s', newformat: 'Y-m-d H:i:s'},sortable:false},
             {label: '采样人',name: 'BCE03A',align: "center",sortable:false},
             {label: '核收人',name: 'BCE03C',align: "center",sortable:false},
             {label: '检验人',name: 'BCE03D',align: "center"},
             {label: '审核时间',name: 'LAB53',align: "center",formatter:'date',formatoptions:{srcformat: 'Y-m-d H:i:s', newformat: 'Y-m-d H:i:s'},sortable:false},
             {label: '申请科室',name: 'BCK03C',align: "center",sortable:false},
             {label: '病区',name: 'BCK03D',align: "center",sortable:false},
             {label: '工作单位',name: 'BAQ03',align: "center",sortable:false},
             {name: 'LAB01',align: "center","hidden":true}
             ],
         rowNum: rownumber,
         sortname: 'lab60',
         grouping: isGroup, //是否分组，默认为false
         groupingView: {
             groupField: groupName, //分组字段
             groupColumnShow: groupShow,    //是否显示分组列
             groupText: groupText,   // 表头显示的数据以及相应的数据量
//             groupCollapse: false, // 加载数据时是否只显示分组的组信息
//             groupDataSorted:false   // 分组中的数据是否排序
             //plusicon:"ui-icon-circle-plus",
             //minusicon:"ui-icon-circle-minus"
             //groupOrder: ['desc']  // 分组后的排序
         },
         onSelectRow: function (id) {
             showTextView();
         },
         loadComplete: function (data) {
//             loadPage(currentPage);
        	 if (data.length < 1) {
  				var $tr = $('#'+tabe_id).find('tbody>tr:last');
  				var len = $tr.find('td').length;
  				$("#"+tabe_id).html('<tr><td colspan="'+ parseInt(len)+ '" style="text-align:left;">没有符合条件的数据！</td></tr>');
  			}

         },
         loadError:function(xhr,status,error){
        	/* layer.msg('检验单服务连接失败！', {
 				time : 2000,
 				icon : 0,
 				skin : 'layui-layer-msg0'
 			});*/
         }

     });
}

function showTextView(){
	   var selectedId = $("#jingdian_left_table").jqGrid("getGridParam","selrow");
       var row = $("#jingdian_left_table").jqGrid("getRowData",selectedId);
       if(!selectedId){
           layer.msg("请选择标本记录",{time:1500,icon:7,skin: 'layui-layer-msg0'});
       }else {
           var params = {};
           params.LAB01 = row.LAB01;
           params.jsessionids=jsessionids;
//           var url = hostUrl + '/inspectreport/getExamresult';
           var url = mqUrl+"/Mq/MQRisPacs/queryJianYanBaoGao";
           $.ajax({
               url: url,
               type: 'get',
               data: params,
               dataType: 'jsonp',
               success: function (resp) {
            	   
            	   var tuxingJson = resp[0];
                   var changguiJson = resp[1];
                   changGuiJqGride(changguiJson);
                   tuXingJqGride(tuxingJson);
                  
               }
           });
       }
}
//图形数据加载
function tuXingJqGride(dataJson){
	$('#jy_jd_tuxCg_content').resize(function(){
		$("#jd_tuxing").setGridWidth($("#jy_jd_tuxCg_content").width()*1);
	});
	 jQuery('#jd_tuxing').GridUnload();//清空表格重新加载
     jQuery('#jd_tuxing').jqGrid({
         datatype: "local",
         data: dataJson,
         rowNum: dataJson.length,
         width:"100%",
         forceFit: true,
         shrinkToFit: true,
         autowidth: true,
         height: "auto",
         colModel : [
                     {label: '说明', name: 'LAD06', align: "center"},
                     {label: '次序', name: 'ROWNR', align: "center"},
                     {label: '类型', name: 'LAC10', align: "center"},
                     {label: '图片', name: '', align: "center",formatter: imageFormat }
                 ],
         gridComplete: function () {
         },
         onSelectRow: function (rowid, status) {


         },
         loadComplete: function (data) {

        	 if (data.rows.length < 1) {
  				var $tr = $('#jd_tuxing').find('tbody>tr:last');
  				var len = $tr.find('td').length;
  				$("#jd_tuxing").html('<tr><td colspan="'+ parseInt(len)+ '" style="text-align:left;">没有符合条件的数据！</td></tr>');
  			}
     }
     });
}

function imageFormat(cellvalue, options, rowdata){
    var url ="data:image/png;base64,"+rowdata.LAD07+"";
    return '<img src="'+url+'"  />';
}
//常规数据
function changGuiJqGride(dataJson){
	
	 jQuery('#jd_changgui').GridUnload();//清空表格重新加载
     jQuery('#jd_changgui').jqGrid({
         datatype: "local",
         data: dataJson,
         rowNum: dataJson.length,
         //width:"auto",
         forceFit: true,
         shrinkToFit: true,
         autowidth: true,
         height: "auto",
         width: "auto",
         colModel: [
             {
                 label: '组合项目',
                 name: 'BBX05A',
                 align: "center",
                 cellattr: function (rowId, tv, rawObject, cm, rdata) {
                     return 'id=\'BBX05A' + rowId + "\'";
                 }
             },
             {label: '项目名称', name: 'BBX05', align: "center"},
             {label: '结果', name: 'LAC10', align: "center"},
             {label: '单位', name: 'BDG02', align: "center"},
             {label: '状态', name: 'LAC11', align: "center"},
             {label: '参考范围', name: 'LAC15', align: "center"},
             {name: 'BFG17', hidden: true},
             {name: 'BFG18', hidden: true}
         ],
     	 afterInsertRow: function(rowid, rowData, rowelem) {
     		 debugger;
			//如果状态是'高'号，给这行的字体置为红色;
			var detail= rowData['LAC11'];
			if(detail=='↑' || rowData["LAC10"]=="阳性" || rowData["LAC10"]=="+"){
				$("#jd_changgui").jqGrid('setRowData', rowid, false, { color: '#FF0000' });
			}//如果状态是'低'号，给这行的字体置为蓝色;
			else if(detail=='↓') {
				$("#jd_changgui").jqGrid('setRowData', rowid, false, { color: '#0494D3' });
			}
			if(rowData.BFG17 && (parseFloat(rowData.LAC10) < parseFloat(rowData.BFG17))){ //极低值
				$("#jd_changgui").jqGrid('setRowData', rowid, false, { background: '#FF0000',color: '#FFF' });
				
			}
			if(rowData.BFG18 && (parseFloat(rowData.LAC10) > parseFloat(rowData.BFG18))){ //极高值
				$("#jd_changgui").jqGrid('setRowData', rowid, false, { background: '#0576b7',color: '#FFF' });
			}
			
			
		},
         gridComplete: function () {
             merger('jd_changgui', 'BBX05A');
         },
         onSelectRow: function (rowid, status) {


         },
         loadComplete: function (data) {
        	 if (data.rows.length < 1) {
  				var $tr = $('#jd_changgui').find('tbody>tr:last');
  				var len = $tr.find('td').length;
  				$("#jd_changgui").html('<tr><td colspan="'+ parseInt(len)+ '" style="text-align:left;">没有符合条件的数据！</td></tr>');
  			}

     }
     });
}

/**
 * 公共同组方法
 * @param gridName
 * @param CellName
 */
function merger(gridName, cellName) {
    //得到显示到界面的id集合
    var mya = $("#" + gridName + "").getDataIDs();
    var length = mya.length;
    for (var i = 0; i < length; i++) {
        //从上到下获取一条信息
    	
        var before = $("#" + gridName + "").jqGrid('getRowData', mya[i]);
        //定义合并行数
        var rowSpanTaxCount = 1;
        for (var j = i + 1; j <= length; j++) {
            //和上边的信息对比 如果值一样就合并行数+1 然后设置rowspan 让当前单元格隐藏
            var end = $("#" + gridName + "").jqGrid('getRowData', mya[j]);
            if (before[cellName] == end[cellName]) {
                rowSpanTaxCount++;
                $("#" + gridName + "").setCell(mya[j], cellName, '', { display: 'none' });
            } else {
                rowSpanTaxCount = 1;
                break;
            }
            $("#" + cellName + "" + mya[i] + "").css({"background": "#FFF","color":"#000"});
            $("#" + cellName + "" + mya[i] + "").attr("rowspan", rowSpanTaxCount);
        }
    }
}


/*检验简约模式数据加载*/

function jianyueJqGride(){
	debugger;
	var vaa03 = $("#patient_vaa03").text().trim();
//	var tableId;
//	var curH = $("#all_patient").find(".active").find("a").attr("href");
//	if(curH == "#mypatinent1"){
//		
//		tableId = "myjiezhenTableList";
//		
//	}else if(curH == "#benkepatient1"){
//		tableId = "jiezhenBenkeTable";
//		
//	}else if(curH == "#wanzhenpatient1"){
//		
//		tableId = "wanzhenBenkeTable";
//	}
//	var selId = $("#"+tableId).jqGrid("getGridParam",'selrow');
//	var jiezhenRow= $("#"+tableId).jqGrid('getRowData',selId);
	
	var tabe_id ="simple-format-table";
	var rownumber =100;
	 var groupName = [];
     var groupText = [];
     var groupShow = [];
     var group1="";
     var isGroup = false;
     var g1 = $('#jianyan_fenzu1').val();
     var g2 = $('#jianyan_fenzu2').val();
     var g3 = $('#jianyan_fenzu3').val();
     if(!!g1){groupName.push(g1);}
     if(!!g2){groupName.push(g2);}
     if(!!g3){groupName.push(g3);}
     if(groupName.length>0){
         isGroup = true;
         group1+= " order by ";
         for(var i=0;i<groupName.length;i++){
             groupShow.push(true);
             groupText.push('<label class="label-normal label-spring">{0} - {1}</label>');
             if(i == groupName.length -1){
            	 group1 +=groupName[i];
             }else{
            	 group1 +=groupName[i]+",";
             }
         }
     }
     jQuery('#simple-format-table').GridUnload();
     var params = {};
 	params.ACF01 = 1;
 	params.LAB09 = vaa03;// 门诊号
// 	params.LAB09 = 'MZ00055125';// 门诊号
// 	params.VAA03 = LAB09;
 	params.VAA03 = '';
 	params.GROUP = group1;
 	params.type = 2;
 	params.currPage = currentPage;
 	params.pageSize = rownumber;
 	params.jsessionids=jsessionids;
     jQuery("#simple-format-table").jqGrid({
         url: mqUrl+"/Mq/MQRisPacs/queryJianYan",
         postData: params,
         datatype: "jsonp",
         mtype: 'get',
         height: 'auto',
         width: "auto",
         colModel: [
                    {label: '检验时间',name: 'FLAB20',align: "center",formatter:'date',formatoptions:{srcformat: 'Y-m-d', newformat: 'Y-m-d'},sortable:false},
                    {label: '仪器',name: 'BEY03',align: "center",sortable:false},
                    {label: '项目名称',name: 'BBX05',align: "center",sortable:false},
                    {label: '缩写',name: 'BFC03',align: "center",sortable:false},
                    {label: '结果',name: 'LAC08',align: "center",sortable:false},
                    {label: '单位',name: 'BDG02',align: "center",sortable:false},
                    {label: '状态',name: 'LAC11',align: "center",sortable:false},
                    {label: '参考范围',name: 'LAC15',align: "center",sortable:false},
                    {label: '打印',name: 'FPRINT',align: "center",sortable:false},
                    {label: '样本类型',name: 'ABB02',align: "center",sortable:false},
                    {label: '婴儿姓名',name: 'VAP05',align: "center",sortable:false},
                    {label: '婴儿性别',name: 'ABW02',align: "center",sortable:false},
                    {label: '婴儿出生日期',name: 'VAP07',align: "center",formatter:'date',formatoptions:{srcformat: 'Y-m-d H:i:s', newformat: 'Y-m-d H:i:s'},sortable:false}

                ],
         rowNum: rownumber,
         sortname: 'lab60',
         grouping: isGroup, //是否分组，默认为false
         groupingView: {
             groupField: groupName, //分组字段
             groupColumnShow: groupShow,    //是否显示分组列
             groupText: groupText,   // 表头显示的数据以及相应的数据量
//             groupCollapse: false, // 加载数据时是否只显示分组的组信息
//             groupDataSorted:false   // 分组中的数据是否排序
             //plusicon:"ui-icon-circle-plus",
             //minusicon:"ui-icon-circle-minus"
             //groupOrder: ['desc']  // 分组后的排序
         },
         onSelectRow: function (id) {
//             showTextView();
         },
         loadComplete: function (data) {
        	 
//             loadPage(currentPage);
        	 if (data.length < 1) {
  				var $tr = $('#'+tabe_id).find('tbody>tr:last');
  				var len = $tr.find('td').length;
  				$("#"+tabe_id).html('<tr><td colspan="'+ parseInt(len)+ '" style="text-align:left;">没有符合条件的数据！</td></tr>');
  			}
         },
         loadError:function(xhr,status,error){
        	/* layer.msg('检验单服务连接失败！', {
 				time : 2000,
 				icon : 0,
 				skin : 'layui-layer-msg0'
 			});*/
         }

     });
}

/**
 * 观片
 */
function guanpian()
{
	debugger;
	layer.closeAll();
//	$('#view-slice').on('click', function () {
        var records = $('#check-report-table').jqGrid('getGridParam', 'records');
        if (!records || records == 0) {
            layer.msg('检查报告数据为空！', {
                time: 3000,
                icon: 0,
                skin: 'layui-layer-msg0'
            });
            return;
        }
        var prm = {};
        prm.productId = 100;
        prm.programId = 105003;
        prm.paramNo = 423;
        var mode = parseInt(getSystemParam(prm));
        var url = '';
        switch (mode) {
            case 1 :                                        //模式1
                var selectedId = $('#check-report-table').jqGrid('getGridParam', 'selrow');
                if (!selectedId) {
                    layer.msg('请选择检查报告！', {
                        time: 3000,
                        icon: 0,
                        skin: 'layui-layer-msg0'
                    });
                    return;
                } else {
                    var selectedData = $('#check-report-table').jqGrid('getRowData', selectedId);
                    url = 'http://localhost:8089/GetRequest?comid=1&comstr=' + selectedData.PAA01;
                }
                break;
            case 6 :                                        //模式2
            	
                url = 'http://localhost:8089/GetRequest?comid=6&comstr=' + $("#vaa01").val();
                break;
        }
        layer.open(
				{
				type : 2,
				title : false, // title 不显示
				closeBtn : 0, // 不显示  layer 弹框关闭按钮
				shadeClose : false,
				shade : false,
				area :
				['0%', '0%'], //在页面上不显示
				content : url, //iframe的url,
				success : function()
				{
					
				}
				});
//        window.open(url);
//    });
}

//获取系统公共参数
function getSystemParam(prm){
     var para = {
				params:JSON.stringify(prm)
		}
	var resp1 = '';
	 $.ajax({
	        type: "GET",
	        url: rootUrl+'/clisendadvice/getSystemParam',
	        data: para,
	        async: false,
	        dataType: "json",
	        success: function(resp){
	        	resp1 = resp.map.value;
	        }

    });
	 return resp1;
}














